﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OnTheWay;
using System.Runtime.Serialization;

namespace Models
{
    [DataBaseTable]
    public class User : OnTheWay.Models.Model
    {
        public enum UserStatus
        {
            正常, 禁止登录
        }

        public enum UserLevel
        {
            普通会员, 白金会员
        }
        /// <summary>
        /// 登录名
        /// </summary>
        [DataMember]
        [DataBaseMember(typeof(string),NotNullable=true, Detail = "登录帐号")]
        public string LoginName { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [DataMember]
        [DataBaseMember(typeof(string), NotNullable = true, Detail = "登录密码")]
        public string Password { get; set; }
        /// <summary>
        /// 会员ID
        /// </summary>
        [DataMember]
        [DataBaseMember(typeof(string), NotNullable = true, Detail = "会员ID")]
        public string VIPID { get; set; }
        /// <summary>
        /// 会员等级
        /// </summary>
        [DataMember]
        [DataBaseMember(typeof(int), NotNullable = true,EnumType=typeof(UserLevel), Detail = "会员等级")]
        public int VIPLv { get; set; }
        public UserLevel LevelEnum { get { return (UserLevel)VIPLv; } set { Status = (int)value; } }
        /// <summary>
        /// 状态
        /// </summary>
        [DataMember]
        [DataBaseMember(typeof(int), NotNullable = true,EnumType=typeof(UserStatus), Detail = "状态")]
        public int Status { get; set; }
        public UserStatus StatusEnum { get { return (UserStatus)Status; } set { Status = (int)value; } }
        /// <summary>
        /// 会员简介
        /// </summary>
        [DataMember]
        [DataBaseMember(typeof(string), Detail = "会员简介")]
        public string VIPDesc { get; set; }
        /// <summary>
        /// 上次登录时间
        /// </summary>
        [DataMember]
        [DataBaseMember(typeof(string), Detail = "上次登录")]
        public DateTime LastLoginTime { get; set; }
    }
}
